package com.spring.security.core.social.config;

/**
 * 社交登录配置主类
 *
 * @author_seabed_moon
 */
//@Configuration
//@EnableSocial
//public class SocialConfig extends SocialConfigurerAdapter {
//
//    @Autowired
//    private DataSource dataSource;
//
//    @Autowired
//    private SecurityProperties securityProperties;
//
//    @Autowired(required = false)
//    private ConnectionSignUp connectionSignUp;
//
//    @Autowired(required = false)
//    private SocialAuthenticationFilterPostProcessor socialAuthenticationFilterPostProcessor;
//
//    /**
//     * @see org.springframework.social.config.annotation.SocialConfigurerAdapter#getUsersConnectionRepository(org.springframework.social.connect.ConnectionFactoryLocator)
//     */
//    @Override
//    public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
//        JdbcUsersConnectionRepository repository = new JdbcUsersConnectionRepository(dataSource,
//                connectionFactoryLocator, Encryptors.noOpText());
//        if (connectionSignUp != null) {
//            repository.setConnectionSignUp(connectionSignUp);
//        }
//        return repository;
//    }
//
//    /**
//     * 社交登录配置类，供浏览器或app模块引入设计登录配置用。
//     *
//     * @return
//     */
//    @Bean
//    public SpringSocialConfigurer sunLandSocialSecurityConfig() {
//        String filterProcessesUrl = securityProperties.getSocial().getFilterProcessesUrl();
//        SunLandSpringSocialConfigurer configurer = new SunLandSpringSocialConfigurer(filterProcessesUrl);
//        configurer.signupUrl(securityProperties.getBrowser().getSignUpUrl());
//        configurer.setSocialAuthenticationFilterPostProcessor(socialAuthenticationFilterPostProcessor);
//        return configurer;
//    }
//
//    /**
//     * 用来处理注册流程的工具类
//     *
//     * @param connectionFactoryLocator
//     * @return
//     */
//    @Bean
//    public ProviderSignInUtils providerSignInUtils(ConnectionFactoryLocator connectionFactoryLocator) {
//        return new ProviderSignInUtils(connectionFactoryLocator,
//                getUsersConnectionRepository(connectionFactoryLocator)) {
//        };
//    }
//}
